
import matplotlib.pyplot as plt

class show:
    def show_grades(self):
        # test = [('数据库', 90), ('机组', 80), ('操作系统', 70), ('英语', 90), ('数学', 80), ('形势', 70)]
        name = []
        grade = []
        count = 0
        for i in self:
            name.append(i[0])
            grade.append(i[1])
            count = count + 1
        plt.rcParams["font.sans-serif"] = ["KaiTi"]   #中文
        plt.rcParams["axes.unicode_minus"] = False

        grades = [grade]
        plt.table(cellText=grades, colLabels=name, loc="center")

        plt.axis('off')#关闭直角坐标
        plt.show()

